/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.nuage.tiow.ui;

import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import java.util.List;
import org.nuage.tiow.vo.system.Planet;
import org.nuage.tiow.vo.system.SolarSystem;
import org.nuage.tiow.vo.system.SystemLocation;

/**
 *
 * @author quentina
 */
public class SolarSystemPanel extends Panel {

    public SolarSystemPanel(SolarSystem solarSystem) {
        setCaption((solarSystem.getLocation() == SystemLocation.IMPERIAL ?
            "Imperial System" : "Hostile System") + " " + solarSystem.getName());

        List<Planet> planets = solarSystem.getPlanets();
        Table table = new Table("Planets", new BeanItemContainer<Planet>(planets));
        table.setVisibleColumns(new Object[] { "name", "type", "criticalObjectives"});
        addComponent(table);
    }

}
